Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add disconnect account approval step #1101

Merged
merged 14 commits into from
Sep 13, 2024

Conversation

euharrison
Copy link
Contributor

@euharrison euharrison commented Sep 12, 2024

Add the disconnection account approval step

This PR also combine e create some methods for the Approvals service to manage the popup easier, the main one is launchApprovalPopup which takes a typed route and custom params. And it'll remove the popup resolver from the map once they are resolved or rejected, or when the popup is removed/closed by the user

Screenshot 2024-09-12 at 19 38 04

Screen.Recording.2024-09-12.at.19.37.00.mov

@@ -10,17 +10,12 @@ export const ApproveConnection: React.FC = () => {
const requester = useRequester();
const params = useQuery();
const interfaceOrigin = params.get("interfaceOrigin");
const interfaceTabId = params.get("interfaceTabId");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interfaceTabId wasn't used anymore, it was replaced by popupTabId directly on the service

const resolver = this.getResolver(tabId);
if (resolver) {
resolver.reject(new Error("Window closed"));
this.removeResolver(tabId);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the user closes the popup, it'll dispatch a message and clean the resolverMap

Screenshot 2024-09-12 at 19 56 37

return popupTabId;
};

private launchApprovalPopup = async <T>(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

launchApprovalPopup now combines the same pattern we have in all functions:

  • Create the url
  • Open the popup
  • Return the resolver promise
  • Plus: when the promise is resolved or rejected, it's also removed from the resolverMap

Copy link
Collaborator

@jurevans jurevans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice!

@euharrison euharrison merged commit 026b971 into main Sep 13, 2024
8 checks passed
@euharrison euharrison deleted the feat/disconnect-account-approval branch September 13, 2024 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants